<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>后台退票申请修改</title>
    <%@include file="common/head.jsp" %>
    <%@include file="common/loginstate.jsp" %>
    <link href="${staticPath}/css/css.css" type=text/css rel=stylesheet>
    <script type="text/javascript" src="${staticPath}/js/popup.js"></script>
    <script type="text/javascript">
        //文件上传
        function upx(id) {
            var pop = new Popup({contentType: 1, isReloadOnClose: false, width: 400, height: 200});
            pop.setContent("contentUrl", "${contextPath}/common/upload/?id=" + id);
            pop.setContent("title", "文件上传");
            pop.build();
            pop.show();
        }

        // 修改退票申请
        function tuipiaoshenqingSet() {
            var id = $('#id').val();
			var xingming  = $("#xingming").length > 0 ? $('#xingming').val().trim():null;
			if($("#xingming").length > 0 && xingming == "")
			{
				alert("please input:姓名");
			    $('#xingming').focus();
				return false;
			}
			var dianhua = $("#dianhua").length > 0 ? $('#dianhua').val().trim():null;
			if ($("#dianhua").length > 0) {
				if (dianhua == "") {
					alert("please input:电话");
					$('#dianhua').focus();
					return false;
				} else {
					if (/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(dianhua)) {
					} else {
						alert("必需手机格式");
						$('#dianhua').focus();
						return false;
					}
				}
			}
			var shenfenzhenghao = $("#shenfenzhenghao").length > 0 ? $('#shenfenzhenghao').val().trim():null;
			if ($("#shenfenzhenghao").length > 0) {
				if (shenfenzhenghao == "") {
					alert("please input:身份证号");
			        $('#shenfenzhenghao').focus();
					return false;
				} else {
					// 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
					if (/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(shenfenzhenghao)) {
					} else {
						alert("必需身份证格式");
			            $('#shenfenzhenghao').focus();
						return false;
					}
				}
			}
			var banci  = $("#banci").length > 0 ? $('#banci').val().trim():null;
			if($("#banci").length > 0 && banci == "")
			{
				alert("please input:班次");
			    $('#banci').focus();
				return false;
			}
			var beizhu  = $("#beizhu").length > 0 ? $('#beizhu').val().trim():null;
			if($("#beizhu").length > 0 && beizhu == "")
			{
				alert("please input:备注说明");
			    $('#beizhu').focus();
				return false;
			}
			var shijian  = $("#shijian").length > 0 ? $('#shijian').val().trim():null;
			if($("#shijian").length > 0 && shijian == "")
			{
				alert("please input:时间");
			    $('#shijian').focus();
				return false;
			}
			var shenhe=$('#shenhe').val().trim();
			var usersid=$('#usersid').val().trim();

            var param = {
                'id': id,
				'xingming':xingming,
				'dianhua':dianhua,
				'shenfenzhenghao':shenfenzhenghao,
				'banci':banci,
				'beizhu':beizhu,
				'shijian':shijian,
				'shenhe':shenhe,
				'usersid':usersid,

            };
            $.ajax({
                type: 'post',
                url: '${basePath}/tuipiaoshenqingAddOrUpdate',
                dataType: "json",
                contentType:"application/json",
                data : JSON.stringify(param),
                success: function (resp) {
                    if (resp.success) {
                        alert("修改成功！");
                        //window.location.href = "${contextPath}/tuipiaoshenqingMana";
                    } else {
                        alert(resp.message);
                    }
                }
            });
        }
    </script>
</head>


<body>

<form name="formAdd" id="formAdd">
    <table width="98%" align="center" border="0" cellpadding="4" cellspacing="1" bgcolor="#CBD8AC"
           style="margin-bottom:8px">
        <tr bgcolor="#EEF4EA">
            <td colspan="3" background="${staticPath}/img/wbg.gif" class='title'><span>&nbsp;退票申请修改</span>
            </td>
        </tr>
		<tr align='center' bgcolor="#FFFFFF" height="22">
			<td width="10%" bgcolor="#FFFFFF" align="right">
				姓名:
			</td>
            <td width="90%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="xingming" id="xingming" value="${tuipiaoshenqing.xingming }" size="90px"/>
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" height="22">
			<td width="10%" bgcolor="#FFFFFF" align="right">
				电话:
			</td>
            <td width="90%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="dianhua" id="dianhua" value="${tuipiaoshenqing.dianhua }" size="90px"/>
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" height="22">
			<td width="10%" bgcolor="#FFFFFF" align="right">
				身份证号:
			</td>
            <td width="90%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="shenfenzhenghao" id="shenfenzhenghao" value="${tuipiaoshenqing.shenfenzhenghao }" size="90px"/>
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" height="22">
			<td width="10%" bgcolor="#FFFFFF" align="right">
				班次:
			</td>
            <td width="90%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="banci" id="banci" value="${tuipiaoshenqing.banci }" size="90px"/>
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" height="22">
			<td width="10%" bgcolor="#FFFFFF" align="right">
				备注说明:
			</td>
            <td width="90%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="beizhu" id="beizhu" value="${tuipiaoshenqing.beizhu }" size="90px"/>
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" height="22">
			<td width="10%" bgcolor="#FFFFFF" align="right">
				时间:
			</td>
            <td width="90%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="shijian" id="shijian" style="border:1px solid #cccccc;" readonly="readonly" size="20px" value="${tuipiaoshenqing.shijian}" />
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" height="22">
			<td width="10%" bgcolor="#FFFFFF" align="right">
				是否审核:
			</td>
            <td width="80%" bgcolor="#FFFFFF" align="left">
                <select name="shenhe" id="shenhe" style="border:solid 1px #000000; color:#666666">
                    <option value="${tuipiaoshenqing.shenhe }">${tuipiaoshenqing.shenhe }</option>
                    <option value="no">no</option>
                    <option value="yes">yes</option>
                </select>
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" height="22">
			<td width="10%" bgcolor="#FFFFFF" align="right">
				用户:
			</td>
            <td width="80%" bgcolor="#FFFFFF" align="left">
                <select name="usersid" id="usersid" style="width: 280px;">
                    <option value="${tuipiaoshenqing.users.id }">${tuipiaoshenqing.users.loginname}</option>
                </select>
            </td>

		</tr>

        <tr align='center' bgcolor="#FFFFFF" height="22">
            <td width="10%" bgcolor="#FFFFFF" align="right">&nbsp;</td>
            <td width="90%" bgcolor="#FFFFFF" align="left">
                <input type="hidden" id="id" name="id" value="${tuipiaoshenqing.id}"/>
                <input type="button" value="提交" onclick="tuipiaoshenqingSet();"/>&nbsp;
                <input type="button" value="返回" onClick="javascript:history.back()"/>
                <input type="reset" value="重置"/>&nbsp;
            </td>
        </tr>
    </table>
</form>

</body>
</html>


